﻿<%@ Page Title="All Events" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="_344A._Default" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        All Events
    </h2>
    <p>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource1" AllowPaging="True" 
            AllowSorting="True" onselectedindexchanged="GridView1_SelectedIndexChanged" 
            Width="920px" DataKeyNames="Event ID" CellPadding="4" ForeColor="#333333" 
            GridLines="None">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:BoundField DataField="Title" HeaderText="Title" 
                    SortExpression="Title" />
                <asp:BoundField DataField="Event ID" HeaderText="Event ID" 
                    SortExpression="Event ID" InsertVisible="False" ReadOnly="True" />
                <asp:BoundField DataField="Hall" HeaderText="Hall" SortExpression="Hall" />
                <asp:BoundField DataField="Date" HeaderText="Date" 
                    SortExpression="Date" />
                <asp:BoundField DataField="Duration" HeaderText="Duration" 
                    SortExpression="Duration" />
                <asp:BoundField DataField="Capacity" HeaderText="Capacity" 
                    SortExpression="Capacity" />
                <asp:TemplateField HeaderText="Open for Bookings" SortExpression="Open for Bookings">
                    <ItemTemplate><%# (Boolean.Parse(Eval("Open for Bookings").ToString())) ? "Yes" : "No" %></ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:Database1ConnectionString %>" 
            
            
            
            SelectCommand="SELECT [title] AS 'Title', [id] AS 'Event ID', [hall] AS 'Hall', [date] AS 'Date', [time] AS 'Duration', [capacity] AS 'Capacity', [status] AS 'Open for Bookings' FROM [Event]">
        </asp:SqlDataSource>
   </p>
</asp:Content>
